<!-- верхняя часть -->
<div style="border-bottom:1px dashed #ccc; padding-bottom:10px;">
	<div class="addobj"><a class="sbtns" href="/<?=FS_CMS?>/add/<?=$razdel[$rname]['tablename'];?>/"><img src="<?=$design_path;?>images/ico-add.png" alt="">&nbsp;&nbsp;Добавить <?=$razdel[$rname]['add-string'];?></a></div>
	<h1>Список объектов раздела &laquo;<?=$razdel[$rname]['name'];?>&raquo;</h1>
</div>


<div class='clearfix'></div>

<?php

$N_subcats=GetChildCategory($rname,"");
if (!empty($N_subcats)) {
	
	
	$numall=count($N_subcats);
	$i=0;
	
	echo "<div align=\"left\"><ul style='width:600px; border-bottom:1px dashed #ccc; padding-bottom:70px;'>";
	//print_r($N_subcats);
	foreach ($N_subcats as $cat) {
	//print_r($cat);
	//echo($CatID);
	if ($CatID==$cat['ID']) $t_cat="font-weight:bold; color:#fff";
	else $t_cat="";
?>
	<li style="float:left; margin-left:10px; margin-top:10px;"><?php
	?><a  style="font-size:12px; <?=$t_cat?>" href="/<?=FS_CMS?>/list/<?=$rname?>/c-<?php echo $cat['uname'] ?>/"><img src="<?=$design_path?>images/ico-category.png" alt="">&nbsp;<?php echo $cat['CatName'] ?></a></li>  


<?
	$i++;
	}//foreach ($N_subcats as $cat)
	echo "</ul></div><div class='clearfix'></div>";
	
}//if (!empty($N_subcats)) {

?>





<!-- // верхняя часть -->


<!-- список -->
<?php
//	echo("<pre>");
//	print_r($RazData);
//	echo("</pre>");
	//$orderby="";
	
if (!empty($RazData)) {
?>

	<table id="obj_list" class="obj_table" style="width:680px;">
<?
		//для начала строим заголовок таблицы
		?>
		<tr class="trzag">
		<?php
		if ($_SESSION['cms-user']['login']=='Nemo') {
		?>
		<td class="zag">ID</td>
		<?php
		}//if ($_SESSION['cms-user']['login']=='Nemo') {
		
		
		$i=1;
		$z=1;
		unset($mod_fields);
		foreach ($razdel[$rname]['fields'] as $field) {
		if (!empty($field['topshow'])) {
	?>
	
		<td class="zag"><?=$field['name'];?></td>
	
	<?php
		
		
		//готовим список полей для вывода в таблицу
		$mod_fields[$i]['name']=$field['fname'];
		$mod_fields[$i]['type']=$field['type'];
		$i++;
		}//if (!empty($field['topshow'])) {
		}//foreach
	?>	
		<td class="zag">изм.</td>
		</tr>
		

		<?php

		//потом содержимое
		?>
		
		<?
		foreach ($RazData as $raz) {
		?>
		<tr class="<?php if ($z%2) echo("zebra");?>">
		<?php
		if ($_SESSION['cms-user']['login']=='Nemo') {
		?>
			<td class="val center"><?=$raz['ID'];?></td>
		<?php
		}//if ($_SESSION['cms-user']['login']=='Nemo') {
		?>
		
		<?
			foreach ($mod_fields as $mlist) {
		//	$obj[$m_field['name']]
		
			if ($mlist['type']=="date") $echo_var = date("Y-m-d H:i", $raz[$mlist['name']]);
			else if ($mlist['type']=="yesno") {
			
				if (!empty($raz[$mlist['name']])) $echo_var = ("<span class='green'>ДА</span>");
				else $echo_var = ("<span class='red'>НЕТ</span>");
			
			}//else if ($mlist['type']=="yesno") {
			else if ($mlist['type']=="varchar") {
			
				 $echo_var = "<a style=\"color:yellow\" href=\"/".FS_CMS."/edit/".$rname."/".$raz['ID']."/\">".$raz[$mlist['name']]."</a>";
				 $echo_var = wordwrap(substr($echo_var, 0, 160), 170, "<br />\n"); //substr($echo_var, 0, 120)."&nbsp;";
			
			}//?php echo  
			else $echo_var=$raz[$mlist['name']];
		
		?>
			<td class="val <?php if ($mlist['type']!="varchar") echo "center";?>"><?=$echo_var?></td>
		<?php
		
		
			}//foreach ($mod_fields as $mlist) {
		?>
			<td class="val center">
				<a href="/<?=FS_CMS?>/edit/<?=$rname?>/<?=$raz['ID']?>/"><img src="<?=$design_path;?>images/ico-edit.png" alt=""></a>
				&nbsp;&nbsp;
				<a href="/<?=FS_CMS?>/del/<?=$rname?>/<?=$raz['ID']?>/" alt=""><img src="<?=$design_path;?>images/ico-del.png" alt=""></a>
			</td>
		</tr>
		<?
		$z++;
		}//foreach ($RazData as $raz) {
		
?>
		
	</table>
<?
}//if (!empty($RazData)) {
	

?>
<!-- // список -->


<!-- ниж - пагинация -->
			
			<div align="left" style="border-top:1px solid #ccc; padding:10px 0px 10px 0px;">
			<div class="addobj"><a class="sbtns" href="/<?=FS_CMS?>/add/<?=$razdel[$rname]['tablename'];?>/"><img src="<?=$design_path;?>images/ico-add.png" alt="">&nbsp;&nbsp;Добавить <?=$razdel[$rname]['add-string'];?></a></div>
			<?php
			//
			//list/=$raz['rname']
			$Url="/".FS_CMS."/list/".$rname."/p-";
			if (!empty($CatID)) $Url.="&amp;CatID=".$CatID;
			$Url.="";
			$start=$page;
			
			
			if (!empty($numall)) echo pagenav_cc($numall, $start, $Url, $limit[1]);
			
			?>
			</div>
<!-- // ниж - пагинация -->